package hash;

import iterator.Iterator;
import visitor.Visitor;
import wrapper.Comparable;
import wrapper.Dbl;
import wrapper.Int;
import wrapper.Chr;
import wrapper.Str;
import container.AbstractSearchableContainer;
import enumeration.Enumeration;

public abstract class AbstractHashTable extends AbstractSearchableContainer
		implements HashTable {

	public abstract int getLength();

	protected final int f(Object object) {
		if (object.getClass().equals(new Int(0).getClass())) {
			System.out.print(((Int) object).getValue() + ": ");
			return (object).hashCode();
		} else if (object.getClass().equals(new Chr(' ').getClass())) {
			System.out.print(((Chr) object).getValue() + ": ");
			return (object).hashCode();
		} else if (object.getClass().equals(new Dbl(0).getClass())) {
			System.out.print(((Dbl) object).getValue() + ": ");
			return (object).hashCode();
		} else {
			System.out.print(((Str) object).getValue() + ": ");
			return (object).hashCode();
		}

	}

	protected final int g(int x) {
		System.out.println(x + "%" + getLength() + "=" + Math.abs(x)
				% getLength());
		return Math.abs(x) % getLength();
	}

	protected final int h(Object object) {
		return g(f(object));
	}

	@Override
	public boolean isMember(Comparable object) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void insert(Comparable object) {
		// TODO Auto-generated method stub

	}

	@Override
	public void withdraw(Comparable object) {
		// TODO Auto-generated method stub

	}

	@Override
	public Comparable find(Comparable object) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void purge() {
		// TODO Auto-generated method stub

	}

	@Override
	public void accept(Visitor visitor) {
		// TODO Auto-generated method stub

	}

	@Override
	public Enumeration getEnumeration() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Iterator getIterator() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public double getLoadFactor() {
		return (double) getCount() / getLength();
	}

	@Override
	protected int compareTo(Comparable arg) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void printHashTable() {

	}

}
